home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 905 < prev    next >
Encoding:
Text File  |  1996-08-06  |  5.7 KB  |  112 lines

  1. Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel,comp.lang.smalltalk
  2. Path: beatty.slip.netcom.com!beatty
  3. From: beatty@netcom.com (Derek Lee Beatty)
  4. Subject: Re: whither style
  5. Message-ID: <4cnmqu$2fg@beatty.slip.netcom.com>
  6. Sender: netnews@mork.netcom.com
  7. Nntp-Posting-Host: beatty.slip.netcom.com
  8. Organization: none
  9. X-Newsreader: Alexandra.app (Version 0.81)
  10. References: <cmanDK7x13.5KM@netcom.com> <30e26364.2569895@news1.wolfe.net> <4bvae4$fl6@beatty.slip.netcom.com> <4c0a6d$4hs@news.irisa.fr>
  11. Date: Sun, 7 Jan 1996 05:48:14 GMT
  12.  
  13. jezequel@stormbringer.irisa.fr (Jean-Marc Jezequel) wrote:
  14. >
  15. >Please note that most of the HN (Hungarian Notation) discussion
  16. >is led in the C and C++ context only.  In Eiffel or Smalltalk,
  17. >where everything is an object, it would be really *stupid* to use
  18. >such a restricted notation: types such as Integer or Float are
  19. >nothing special w.r.t the language, and they are no more important
  20. >than e.g., linked_list_of_hash_table_of_foo.
  21.  
  22. Although I know little about Eiffel, I'm quite cognizant of Smalltalk's type 
  23. system, and I concede from that (rather narrow) viewpoint Integer and Float 
  24. are not special.  However, from the standpoints of utility or simplicity of 
  25. concept, there is something fundamental about concepts such as Number or 
  26. Symbol, and from the standpoint of efficiency, there is something fundamental 
  27. about hardware-supported types.
  28.  
  29. This actually brings up an interesting question: is the appropriateness of a 
  30. naming convention related more to the nature of the problem domain, or more 
  31. to the nature of the programming language?  Maybe the former.  Every 
  32. well-written moderate or large software system I've seen is layered, and the 
  33. higher levels make use of problem-domain abstractions.  These abstractions 
  34. are largely independent of the programming language.  This then argues that 
  35. the importance of type distinctions, and consequently the visibility they 
  36. should have in the source code, is a function of the problem domain.
  37.  
  38. In my work, one hallmark is multiplicity of representation.  External 
  39. constraints very often dictate that I maintain numerous representations of 
  40. the same underlying thing.  Maintaining this correlation consistently and 
  41. clearly in the source code is important.  There HN is useful because we can 
  42. use the same "base name" for both representations, and let the "Hungarian" 
  43. prefix distinguish them.
  44.  
  45. Certainly, we could invent our own naming convention to solve the problem, 
  46. but why bother when an existing naming convention serves well?  This frees 
  47. our attention so we can turn to more important concerns (like how to reduce 
  48. the number of different representations).
  49.  
  50. >Beside, languages such as Smalltalk, Ada, Modula, Eiffel are not
  51. >half-backed about typing:  either they are not typed (actually
  52. >dynamically type), or strongly typed. In both cases, HN is mostly
  53. >irrevelant. Idem for allocation classes, global vs. local, etc.:
  54. >in Eiffel for instance you do not have to mess with this low level
  55. >stuff (but you can if you want so).
  56.  
  57. As to typing, I have to disagree, having found HN quite useful on a project 
  58. where I used ANSI C with full "function prototypes" (why couldn't C call them 
  59. something more reasonable like "interface defintions") where strong typing 
  60. was enforced.  But as I said above, the utility of HN could be more a 
  61. function of my problem domain.
  62.  
  63. As to allocation, inattention to storage management is probably the source of 
  64. much of the perceived inefficiency of advanced languages relative to 
  65. lower-level ones like C++.  Garbage collection allows one to ignore storage 
  66. management for too long---after all, by construction there are no 
  67. memory-mangement bugs---until the memory footprint has ballooned.  In a 
  68. virtual-memory environment, once your working set exceeds the capacity of the 
  69. translation lookaside buffer, performance plummets.  (That said, I still 
  70. prefer GC; it lets me worry about memory management only when that is truly 
  71. necessary; without it I must be ever vigilant.)
  72.  
  73. As to scope, surely if you're smart enough to use Eiffel you're not using 
  74. global variables, or at least not very many of them, or at least not without 
  75. some clear way to distinguish them.  Actually, I'm a bit surprised that 
  76. Eiffel has global variables, but you brought them up.
  77.  
  78. >Since you are in a really modular language (Ada*, Modula*, Eiffel,
  79. >Smalltalk) the declaration of a variable type should be located
  80. >close to its uses. And if your program unit is longer than a few
  81. >tens of lines (which is poor style in e.g., Eiffel), *any* decent
  82. >environment would show you a variable's type only by clicking on
  83. >it.
  84.  
  85. It sometimes seems difficult for people who do research or writing about 
  86. programming (as opposed to those who actually do programming) to realize, but 
  87. not all activities related to programming are conducted in "programming 
  88. environments."  Code is discussed in email, and in company-private 
  89. newsgroups, and in meetings called "code reviews" which typically are done 
  90. from printed listings.  And yes, a good environment will show me a variable's 
  91. type just by clicking on it, but with HN I know the type just by *looking* at 
  92. it, and looking is even easier than clicking.  
  93.  
  94. >So in conclusion, HN really are
  95. >...
  96. >>programming conventions ... developed to compensate for language flaws, are 
  97. >...
  98. >
  99. >thus mostly relevant to C and C++. So please keep the discussion
  100. >in these groups.
  101.  
  102. Were that to be done, this thread would die just when it is becoming more 
  103. interesting.  The assertion has been made that language and technology better 
  104. solve the problem that HN attempts to address.  I disagree because I prefer 
  105. three tools to two (and I'm not convinced that language is relevant at all).  
  106.  
  107. -- 
  108. Derek Lee Beatty      _
  109. beatty@netcom.com          _| ~-,
  110. Austin, Texas              \, * )
  111.               \_(
  112.